/* Author : Maisa Nurul Agnia */
package jtk.project4.fleet.field;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.MemoField;
import nl.coderight.jazz.form.field.SpinnerField;
import nl.coderight.jazz.form.field.TextField;

public class AddEditPartToPurchaseOrderField extends GroupControl{
	private ComboField partField; // table
	
	private TextField nameField;
	private ComboField<String> warehouseField;
	private TextField warrantyField;
	private SpinnerField<Float> quantityOrderedField;	//spinner
	private TextField unitCostField;
	private TextField extendedCostField;
	private MemoField notesField;
	
	

	public AddEditPartToPurchaseOrderField(String bindID){
	//	setTitle("header.AddEditPartToPO"); //disesuaikan dengan nama field
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields()
	{
		
		nameField = new TextField("name",20);
		nameField.setRequired(true);
		
		partField = new ComboField <String> ("PurchaseOrder","wow");
		partField.setPreferredSize(nameField.getPreferredSize());
		
		warehouseField = new ComboField <String> ("PurchaseOrder","tes");
		warehouseField.setPreferredSize(nameField.getPreferredSize());
			
		warrantyField = new TextField("warranty",20);
		warrantyField.setRequired(true);
		
		quantityOrderedField = new SpinnerField<Float>("quantity", "quantity") ;
		quantityOrderedField.setPreferredSize(warrantyField.getPreferredSize());
		
		unitCostField = new TextField("unitCost",20);
		unitCostField.setRequired(true);
	
		extendedCostField = new TextField("extendedCost",20);
		extendedCostField.setRequired(true); //( nama table yang dituju,isi combobox);

		notesField = new MemoField();
		notesField.setRows(3);
		//notesField.setRequired(false);
		
	
		
		
		
	}
	
	private void createLayout()
	{
		setLayout(new FormLayout())
		.addLabel("label.Part#")	  		.addField(partField)
		.addRow()
		.addLabel("label.Name")		  		.addField(nameField)
		.addRow()
		.addLabel("label.Warehouse") 		.addField(warehouseField)
		.addRow()
		.addLabel("label.Warranty")  		.addField(warrantyField)
		.addRow()
		.addLabel("label.QuantityOrdered")  .addField(quantityOrderedField)
		.addRow()
		.addLabel("label.Unitcost")   		.addField(unitCostField)
		.addRow()
		.addLabel("label.ExtendedCost")   	.addField(extendedCostField)
		.addRow()
		.addLabel("label.Notes")      		.addField(notesField)
		
		;
	}
}
